package com.skytech.component.crawler.web;

import com.skytech.component.crawler.parse.ParserLoader;
import com.skytech.component.crawler.task.CrawlerTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CrawlerTaskController {
    @Autowired
    private CrawlerTask crawlerTask;
    @Autowired
    private ParserLoader parserLoader;
    @GetMapping("crawler/task/start/{status}")
    public String startTask(@PathVariable Boolean status){
        crawlerTask.startTask(status);
        return "开始爬虫";
    }
    @GetMapping("crawler/task/time")
    public Double getTime(){
        return crawlerTask.getTime();
    }
    @GetMapping("crawler/task/parse")
    public String parse(){
        crawlerTask.parse();
        return "开始解析";
    }

}
